package com.app.ytong.bean;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.ArrayList;

import my.MathUtils;

public class RecordListBean extends BaseListBean {

    private ArrayList<RecordListData> list = new ArrayList<RecordListData>();

    public ArrayList<RecordListData> getList() {
        return list;
    }

    @JSONField(name = "records")
    public void setList(ArrayList<RecordListData> list) {
        this.list = list;
    }

    @JSONField(serialize = false)
    public void addListBean(RecordListBean listbean) {
        if (listbean == null)
            return;
        if (this.getCurrentPage() == INIT_PAGE) {
            setList(listbean.getList());
        } else {
            if (list == null)
                list = new ArrayList<RecordListData>();
            list.addAll(listbean.getList());
        }
        setListBeanData(listbean);
    }

    @JSONField(serialize = false)
    public String getAllMoney() {
        if (list == null)
            return "0";
        String a = "0";
        for (RecordListData data : list){
            a = MathUtils.add(a,data.getTotal());
        }
        return a;
    }


    @JSONField(serialize = false)
    public String getAllWeight() {
        if (list == null)
            return "0";
        String a = "0";
        for (RecordListData data : list){
            a = MathUtils.add(a,data.getGwt());
        }
        return a;
    }

}
